package algorithm.sphericharmonics;

public final class IntList{
	private int[] data; 
	private int size;
	private static final int DEFAULT_CAPACITY = 16;
	protected int modCount;
	public  IntList(){ 
		data=new int[DEFAULT_CAPACITY]; 
	}
	public final boolean add(int e){
	    modCount++;
	    if (size == data.length){
	      ensureCapacity(size + 1);
	    }
	    data[size++] = e;
	    return true;
	}
	public final int get(int i){
		return data[i]; 
	}
	public final int size(){
		return size; 
	}
	public void ensureCapacity(int minCapacity){
	    int current = data.length;
	    if (minCapacity > current){
	      int[] newData = new int[Math.max(current * 2, minCapacity)];
	      System.arraycopy(data, 0, newData, 0, size);
	      data = newData;
	    }
	  }
}
